package com.link2room.bumblebee.facade.impl;

import com.link2room.bumblebee.dto.param.base.FindWebSettingParamDto;
import com.link2room.bumblebee.dto.result.base.WebSettingsDto;
import com.link2room.bumblebee.entity.WebSettingsEntity;
import com.link2room.bumblebee.facade.IWebSettingApiFacadeService;
import com.link2room.common.jpa.result.QueryResult;
import com.link2room.common.service.ICommonService;
import com.link2room.common.util.ClassConverUtil;
import com.link2room.common.util.L2RAssert;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * Created by LN on 2018/1/11
 */
@Component("webSettingApiFacadeService")
public class WebSettingApiFacadeServiceImpl implements IWebSettingApiFacadeService {
    @Resource
    private ICommonService commonService;
    @Override
    public WebSettingsDto listWebSettingsDto(FindWebSettingParamDto paramDto) throws Exception {

        String domain = paramDto.getDomain();
        L2RAssert.stringBlank(domain,"[domain] is required.");
        WebSettingsEntity find = new WebSettingsEntity();

        find.setDomain(domain);
        WebSettingsEntity qres = commonService.findOneEQ(WebSettingsEntity.class, find);
        return ClassConverUtil.copyProperties(qres,WebSettingsDto.class);
    }
}
